System variables
System variables all have in common that the result is a string defined by the system. They are used in a template file or in a content file. The value of a system variable can be inserted everywhere in the text by typing:
${variable-name}
Here is a list of predefined system variables:
omit_home_from_main_menu
- Definition:
-
If it has value 1, this prevents the name of the home page shown in the navigation menus.
- Values:
-
0 or 1
- Usage:
-
Must be specified in the configuration file.
Default value: 0
home_title
- Definition:
-
Name of the home page in navigation menus. Only relevant if the home page in menus must be displayed. See variable omit_home_from_main_menu.
- Values:
-
text string
- Usage:
-
Must be specified in the configuration file.
Default value: Home
content_dir
- Definition:
-
Location of the content directory. Path is relative to the location of the configuration file.
- Values:
-
valid path as text string
Example of absolute path: /home/user/work/my_demo/version1/demo_content
Example of relative path: version1/demo_content (config file in directory my_demo)
- Usage:
-
Must be specified in the configuration file.
Default value: content
Full path is set to the variable: CONTENT_BASE_PATH
include_dir
- Definition:
-
Location of the include directory. Path is relative to the location of the configuration file. The include directory is copied to the target directory when creating a website. Include directory contains stylesheets, images, javascript, etc.
- Values:
-
valid path as text string
- Usage:
-
Must be specified in the configuration file.
Default value: include
Full path is set to the variable: INCLUDE_BASE_PATH
style_dir
- Definition:
-
Location of the style directory. Path is relative to the location of the configuration file. The style directory contains stylesheets which are evaluated when creating a website.
- Values:
-
path as text string or empty string; must be subdirectory of the include directory.
- Usage:
-
Must be specified in the configuration file.
Stylesheets are not evaluated if the value of this variable is empty or is not a valid subdirectory.
Default value: empty
template_dir
- Definition:
-
Location of the template directory. Path is relative to the location of the configuration file. Contains the templates for the website.
- Values:
-
valid path as text string
- Usage:
-
Must be specified in the configuration file.
Default value: templates
Full path is set to the variable: TEMPLATE_BASE_PATH
target_dir
- Definition:
-
Location of the target directory. Path is relative to the location of the configuration file. The created website is located in the target directory.
- Values:
-
valid path as text string
- Usage:
-
Must be specified in the configuration file.
Default value: site/target
Full path is set to the variable: TARGET_BASE_PATH
page_format
- Definition:
-
How the markup text in the content sections is translated to XHTML.
- Values:
-
txt2tags, html, markdown, rst, textile, creole
- Usage:
-
Must be specified in the variable section of a content file.
The value html means no translation.
The value rst means translation of reStructuredText to XHTML.
Default value: txt2tags
page_template
- Definition:
-
Defines the name of the template file for the page. Template files are located in the template directory.
- Values:
-
valid filename as text string
- Usage:
-
Must be specified in the variable section of a content file. By reading this variable the system knows the name of the template file.
Default value: template
page_title
- Definition:
-
The title of the page.
- Values:
-
text string
- Usage:
-
Must be defined in the variable section of a content file.
Can be used in the template file to give the page a title with the <title> tag.
Default value: name of the content file.
path_to_root
- Definition:
-
Relative path of the current page to the root directory of the website.
- Values:
-
valid path as text string
- Usage:
-
Readonly variable which is computed by the system. This the most important variable of Txt2Site. Used for example to reference to a stylesheet or an image in the include directory.
page_source_mtime
- Definition:
-
Last mutation date and time of the content file for the current page.
- Values:
-
date/time as text string
- Usage:
-
Readonly variable which is computed by the system.
page_source
- Definition:
-
Path of the content file for the current page relative to the content directory.
- Values:
-
valid path as text string
- Usage:
-
Readonly variable which is computed by the system. Can be used to show the content file on the web page. Only usable if the content directory is part of the website. This can be done by making the content directory part of the include directory. See the Examples section.
page_to_next
- Definition:
-
Path to the next pagefile in the hierarchy of pages. Relative to the current page. If at the end, it starts with the first page.
- Values:
-
path as text string
- Usage:
-
Readonly variable which is computed by the system. Can be used to create a link to the next page.
For example using txt2tags markup create a link to the next page by:
[goto next page ${page_to_next}]
page_to_prev
- Definition:
-
Path to the previous pagefile in the hierarchy of pages. Relative to the current page. If at the begin, it skips to the last page.
- Values:
-
path as text string
- Usage:
-
Readonly variable which is computed by the system. Can be used to create a link to the previous page.
page_to_first
- Definition:
-
Path to the first pagefile in the hierarchy of pages. Relative to the current page.
- Values:
-
path as text string
- Usage:
-
Readonly variable which is computed by the system. Can be used to create a link to the first page.
page_to_last
- Definition:
-
Path to the last pagefile in the hierarchy of pages. Relative to the current page.
- Values:
-
path as text string
- Usage:
-
Readonly variable which is computed by the system. Can be used to create a link to the last page.
page_to_parent
- Definition:
-
Path to the parent pagefile in the hierarchy of pages. Relative to the current page.
- Values:
-
path as text string
- Usage:
-
Readonly variable which is computed by the system. Can be used to create a link to the parent page.
Internal system variables
Some variables are for internal use but can also be used in a template file or content file.
- APPLICATION_PATH
-
Root of the application; where the config file resides.
- CONTENT_BASE_PATH
-
Directory of content files.
- INCLUDE_BASE_PATH
-
Include directory
- TEMPLATE_BASE_PATH
-
Template directory
- TARGET_BASE_PATH
-
Target directory; location of the website
- CURRENT_CONTENT_FILE
-
Content file which is current at the moment of processing.
- TXT2SITE_LIB_DIR
-
Directory of the library scripts.